﻿@using CSM_SQL;
@model List<OrderMes>

<section class="shopping-cart">
    <!-- .shopping-cart -->
    <div class="container">
        <div class="row">
            <div class="col-md-12">

            </div>
            <hr />
            <div class="col-md-12">
                <br />
                <hr />
                <h1>任务列表</h1>

                <ul id="myTab" class="nav nav-tabs">
                    <li class="active">
                        <a href="#task1" data-toggle="tab">
                            可申请任务
                        </a>
                    </li>
                    <li class="dropdown">
                        <a href="#" id="myTabDrop1" class="dropdown-toggle"
                           data-toggle="dropdown">
                            已申请任务
                            <b class="caret"></b>
                        </a>
                        <ul class="dropdown-menu" role="menu" aria-labelledby="myTabDrop1">
                            <li><a href="#task2" tabindex="-1" data-toggle="tab">待完成</a></li>
                            <li><a href="#task3" tabindex="-1" data-toggle="tab">已完成</a></li>
                        </ul>
                    </li>
                </ul>
                <div id="myTabContent" class="tab-content">
                    <div class="tab-pane fade in active" id="task1">
                        <table>
                            <tr>
                                <th>客户名</th>
                                <th>客户地址</th>
                                <th>商品名</th>
                                <th>数量</th>
                                <th>质量</th>
                                <th>备注</th>
                                <th>申请</th>
                            </tr>
                            @foreach (var m in Model.Where(a=>a.order.State==0))
        {
                            <tr>
                                <td>@m.customer.Name</td>
                                <td>@m.customer.Address</td>
                                <td>@m.goods.Name</td>
                                <td>@m.order.Amount</td>
                                <td>@{var w = m.order.Amount * m.goods.Weight;} @w</td>
                                <td><span>@m.order.remark</span></td>
                                <td>@if (m.order.Temp == 0) { <a href="/Home/Apply/@m.order.ID" class="red"><i class="icon icon-Anchor" aria-hidden="true"></i></a>}</td>
                            </tr>
}
                           
                        </table>
                    </div>
                    <div class="tab-pane fade" id="task2">
                        <table>
                            <tr>
                                <th>客户名</th>
                                <th>客户地址</th>
                                <th>商品名</th>
                                <th>数量</th>
                                <th>质量</th>
                                <th>备注</th>
                                <th>状态</th>
                            </tr>
                            @foreach (var m in Model.Where(a=>a.order.State == 1 || a.order.State == 2))
        {
                    <tr>
                        <td>@m.customer.Name</td>
                        <td>@m.customer.Address</td>
                        <td>@m.goods.Name</td>
                        <td>@m.order.Amount</td>
                        <td>@{var w = m.order.Amount * m.goods.Weight;} @w</td>
                        <td><span>@m.order.remark</span></td>
                        <td>
                        @switch (m.order.State)
                                    {
                                        case 1:<a href=@Url.Action("Send",new { id=m.order.ID}) style="color:goldenrod"><i class="icon icon-Agenda" aria-hidden="true"></i>待配送</a>  break;
                                        case 2:<a href="JavaScript:void(0)" style="color:yellowgreen"><i class="icon icon-Arrow" aria-hidden="true"></i>待签收</a>  break;
                                        }
                        </td>
                    </tr>
}
                            
                        </table>
                    </div>
                    <div class="tab-pane fade" id="task3">
                        <table title="已完成任务">
                            <tr>
                                <th>评价</th>
                                <th>客户名</th>
                                <th>商品名</th>
                                <th>数量</th>
                                <th>备注</th>
                                <th>评价详情</th>
                            </tr>
                            @foreach (var m in Model.Where(a=>a.order.State >= 3))
        {
                    <tr>
                        <th>
                            <div class="star2">

                                <ul>
                                    @{  var i = 0;
                                        var grade = (m.assess == null) ? (0) : (m.assess.Grade);
                                        var assess =(m.assess == null) ? ("用户没有评论。"): (m.assess.Assess1);}
                            @for (;i<grade ; i++)
            {
                        <li class="yellow-color"><i class="fa fa-star" aria-hidden="true"></i></li>
}

                        @for (; i < 5; i++)
            {
                        <li><i class="fa fa-star" aria-hidden="true"></i></li>
}


                                </ul>
                            </div>
                        </th>
                        <td>@m.customer.Name</td>
                        <td>@m.goods.Name</td>
                        <td>@m.order.Amount</td>
                        <td><span>@m.order.remark</span></td>
                        <td>@assess</td>
                    </tr>
}
                           
                        </table>
                    </div>
                    
                </div>
             

            </div>
        </div>

    </div>
    <!-- /.shopping-cart -->
</section>


